angular.module('starter.services', [])
.factory('city',function ($http) {
	var selectCity = function () {
		return $http.get("/lvmama/bullet/index.php?s=/Ticket/getTicketStation&format=json&firstChannel=TOUCH&secondChannel=LVMM")
		.then(function (res) {
			return res
		})
	}
	var cities = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
	return {
		selectCity : selectCity,
		cities : cities
	}
})
.factory('find',function ($http) {
	var page1 = 1;
	var page2 = 1;
	var page3 = 1;
	var findMoreData = function () {
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=TICKET&page=1&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return  res;
		})
	}
	var loadMore = function () {
		page1++;
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=TICKET&page=" + page1 + "&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return  res;
		})
	}
	var around = function () {
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=DESTINATION&page=1&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return res
		})
	}
	var aroundMore = function () {
		page2++;
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=DESTINATION&page=" + page2 + "&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return res
		})
	}
	var domestic = function () {
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=LOCAL&page=1&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return res
		})
	}
	var domesticMore = function () {
		page3++;
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&stationId=191&type=HOME&subType=LOCAL&page=" + page3 + "&pageSize=5&lvversion=7.8.0")
		.then(function (res) {
			return res
		})
	}
	return{
		findMoreData : findMoreData,
		loadMore : loadMore,
		around : around,
		aroundMore : aroundMore,
		domestic : domestic,
		domesticMore : domesticMore
	}
})
.factory('hotel',function ($http) {
	var hotelBanner = function () {
		return $http.get("/lvmama/bullet/index.php?s=/Api/getHotelInfos&channelCode=DJDJ1&stationCode=SH&tagCodes=JD_JDDbanner&firstChannel=TOUCH&secondChannel=LVMM")
		.then(function (res) {
			return res
		})
	}
	var sBanner = function () {
		return $http.get("/lvmama/bullet/index.php?s=/Api/getHotelInfos&channelCode=DJDJ1&stationCode=SH&tagCodes=JD_DJXbanner,JD_MDD,JD_ZT,JD_RMTJ1&firstChannel=TOUCH&secondChannel=LVMM")
		.then(function (res) {
			return res
		})
	}
	var billBoard = function () {
		return $http.get("/lvmama/bullet/index.php?s=/AutoRecommended/autoRecommended&page=1&pageSize=28&stationId=9&subType=HOTEL&type=VACATIOHOTEL&firstChannel=TOUCH&secondChannel=LVMM")
		.then(function (res) {
			return res
		})
	}
	return{
		hotelBanner : hotelBanner,
		sBanner : sBanner,
		billBoard : billBoard
	}
})
//自驾游
.factory('selftravel',function($http){
	var page1 = 1
	var page2 = 1
	var page3 = 1
	var selftra = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_BANNER&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
			 //https://m.lvmama.com/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ1&firstChannel=TOUCH&secondChannel=LVMM
	var joinclub = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ1&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
			//https://m.lvmama.com/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ4&firstChannel=TOUCH&secondChannel=LVMM
	var sanya = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ4&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var chihuo = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ2&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var zijia = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_HTTJ3&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var week = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_ZM&page=1&pageSize=5&globalLongitude=&globalLatitude=&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var threehour = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_SXS&page=1&pageSize=5&globalLongitude=138.252924&globalLatitude=36.204823999999995&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var longrange = function(){
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_GYCC&page=1&pageSize=5&globalLongitude=138.252924&globalLatitude=36.204823999999995&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	var moreweek = function(){
		page1++
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_ZM&page="+page1+"&pageSize=5&globalLongitude=&globalLatitude=&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var morethreehour = function(){
		page2++
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_SXS&page="+page2+"&pageSize=5&globalLongitude=138.252924&globalLatitude=36.204823999999995&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	
	var morelongrange = function(){
		page3++
		return $http.get("/lvmama/bullet/index.php?s=/Api/getInfos&stationCode=CD&channelCode=ZJY&tagCodes=ZJY_GYCC&page="+page3+"&pageSize=5&globalLongitude=138.252924&globalLatitude=36.204823999999995&firstChannel=TOUCH&secondChannel=LVMM")
	.then(function(res){
		return res
	})
	}
	return {
		selftra:selftra,
		joinclub:joinclub,
		sanya:sanya,
		chihuo:chihuo,
		zijia:zijia,
		week:week,
		threehour:threehour,
		longrange:longrange,
		moreweek:moreweek,
		morethreehour:morethreehour,
		morelongrange:morelongrange
		
		
	}
})